<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Capsule - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
	<h1 translate="no">Capsule</h1>
		<section>
			<header>
				<div class="class-description"><p>A capsule is essentially a cylinder with hemispherical caps at both ends.
It can be thought of as a swept sphere, where a sphere is moved along a line segment.</p>
<p>Capsules are often used as bounding volumes (next to AABBs and bounding spheres).</p></div>
			</header>
			<article>
				<h2 class="subsection-title">Import</h2>
				<p><span translate="no">Capsule</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
				<pre><code class="language-js">import { Capsule } from 'three/addons/math/Capsule.js';</code></pre>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="Capsule" translate="no">new <a href="#Capsule">Capsule</a><span class="signature">( start : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, end : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, radius : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new capsule.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>start</strong>
									</td>
									<td class="description last">
										<p>The start vector.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>end</strong>
									</td>
									<td class="description last">
										<p>The end vector.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>radius</strong>
									</td>
									<td class="description last">
										<p>The capsule's radius.</p>
										<p>Default is <code>1</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="end" translate="no">.<a href="#end">end</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
					<div class="description">
						<p>The end vector.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="radius" translate="no">.<a href="#radius">radius</a><span class="type-signature"> : number</span> </h3>
					<div class="description">
						<p>The capsule's radius.</p>
						<p>Default is <code>1</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="start" translate="no">.<a href="#start">start</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
					<div class="description">
						<p>The start vector.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Capsule.html">Capsule</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns a new capsule with copied values from this instance.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( capsule : <span class="param-type"><a href="Capsule.html">Capsule</a></span> )</span><span class="type-signature"> : <a href="Capsule.html">Capsule</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Copies the values of the given capsule to this instance.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>capsule</strong>
									</td>
									<td class="description last">
										<p>The capsule to copy.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this capsule.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getCenter" translate="no">.<a href="#getCenter">getCenter</a><span class="signature">( target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the center point of this capsule.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>target</strong>
									</td>
									<td class="description last">
										<p>The target vector that is used to store the method's result.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The center point.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="intersectsBox" translate="no">.<a href="#intersectsBox">intersectsBox</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns <code>true</code> if the given bounding box intersects with this capsule.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>box</strong>
									</td>
									<td class="description last">
										<p>The bounding box to test.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> Whether the given bounding box intersects with this capsule.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( start : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, end : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, radius : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Capsule.html">Capsule</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the capsule components to the given values.
Please note that this method only copies the values from the given objects.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>start</strong>
									</td>
									<td class="description last">
										<p>The start vector.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>end</strong>
									</td>
									<td class="description last">
										<p>The end vector</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>radius</strong>
									</td>
									<td class="description last">
										<p>The capsule's radius.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this capsule.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="translate" translate="no">.<a href="#translate">translate</a><span class="signature">( v : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Capsule.html">Capsule</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Adds the given offset to this capsule, effectively moving it in 3D space.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>v</strong>
									</td>
									<td class="description last">
										<p>The offset that should be used to translate the capsule.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this capsule.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Capsule.js" translate="no" target="_blank" rel="noopener">examples/jsm/math/Capsule.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>